// 统一管理用户相关的接口
import request from '@/utils/request'
import type {
  // LoginFormData,
  // LoginResponseData,
  // userInfoResponseData,
  AdResponseData,
  AppResponseData,
  ADFormData
} from './type'
import { createLogger } from 'vite'
// 统一管理接口
enum API {
  LOGIN_URL = '/admin/acl/index/login',
  USERINFO_URL = '/admin/acl/index/info',
  LOGOUT_URL = '/admin/acl/index/logout',
  AD_LIST='/official/advertisement/getBYPosition',
  CustomerService_LIST='/official/CustomerService/getBYPosition',
  App_LIST='/official/appVersion/getAppInfo',
  GET_APP_BY_TYPE='/official/appVersion/getAppByType',
}
// 对外暴露请求函数
// 登录接口方法
// export const reqLogin = (data: LoginFormData) =>
//   request.post<any, LoginResponseData>(API.LOGIN_URL, data)
//
// export const reqUserInfo = () =>
//   request.get<any, userInfoResponseData>(API.USERINFO_URL)
//
// export const reqLogOut = () => request.post<any, any>(API.LOGOUT_URL)
//获取广告列表
export const getAdvertisementList = (params) =>
{
  const parms = [];
  for (let key in params) {
    if (params[key]) {
      parms.push(`${key}=${params[key]}&`);
    }
  }
  const url = `?${parms.join('&')}`;
  return request.get<any,AdResponseData>(`${API.AD_LIST}${url}`)
}

//查询客服微信配置列表
export const getCustomerServiceList = () =>
  request.get<any,AdResponseData>(API.CustomerService_LIST)

//获取app列表
export const getAppList = () =>
  request.get<any,AppResponseData>(API.App_LIST)
//按客户端类型获取最新地址
export const getAppByType = (data) =>
  request.post<any,AppResponseData>(API.GET_APP_BY_TYPE,data)